home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / appkit.774 < prev    next >
Text File  |  1992-02-06  |  2KB  |  36 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f2\fmodern Courier;\f1\fswiss Helvetica;}
  2. \paperw11580
  3. \paperh7980
  4. \margl120
  5. \margr120
  6. {\colortbl\red0\green0\blue0;}
  7. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b0\i0\ul0\fs28 lockFocus window view\
  8. \
  9.  
  10. \fi-420\li420 Q:  
  11. \fc0 I am trying to draw something to my view and getting the message:\
  12. \
  13.     
  14. \f2\fs24 Assertion failed: No REAL window during lockFocus on a view
  15. \f0\fs28 \
  16.  
  17. \pard\tx380\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fi-420\li420 \
  18.     I've checked and the window instance variable of the view is non-nil, why am I getting this message?\
  19.  
  20. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600     \
  21.  
  22. \fi-420\li420 A:  
  23. \fc0 A REAL window is a PostScript window.  Your check for a non-nil window assures that you have a AppKit-side window, but it doesn't check to make sure there is an associated PostScript window.  When you grab a window in InterfaceBuilder, it is deferred by default.  When a window is deferred the associated PostScript window won't be created until you actually bring that window on screen.  You cannot draw to a window which doesn't yet have a PostScript window.   You can change the deferred status using the “Deferred” switch button on the InterfaceBuilder Window inspector or with the proper argument to the Window method  (
  24. \b initContent:style:backing:buttonMask:defer:
  25. \b0 ).  If you're ever in doubt about a view's status, you can use the 
  26. \b canDraw
  27. \b0  method which returns a boolean which indicates whether you are able to draw to that view.\
  28.  
  29. \fi0\li0 \
  30. QA774\
  31. \
  32. Valid for 1.0\
  33. Valid for 2.0\
  34. \
  35.  
  36.